#coding: utf-8
class CulturalHeritage::Shape < ActiveRecord::Base
  validates :name, :presence => {:message => "El nombre del Periodo es requerido"}
  default_scope where("deleted = 0")
  has_many :list_cultural_heritages, :class_name => 'CulturalHeritage::CulturalHeritage',  :foreign_key => 'shape'

  def erasable
    cultuheri = CulturalHeritage::CulturalHeritage.count_shape_dependencies(id)
    if cultuheri >0
      return "Imposible borrar. Existen dependencias en patrimonio cultural/preregistro"          
    end
    return nil
  end
end
